﻿namespace Skymate
{
    using System;

    using Abp.Logging;

    using Castle.Core.Logging;

    using SuperSocket.SocketBase;
    using SuperSocket.SocketEngine;

    using WeifenLuo.WinFormsUI.Docking;

    /// <summary>
    ///     The server form.
    /// </summary>
    public partial class ServerForm : DockContent
    {        
        public ServerForm()
        {
            this.InitializeComponent();
            this.Logger = LogHelper.Logger;
        }

        public ILogger Logger { get; set; }

        private void button2_Click(object sender, EventArgs e)
        {
            var bootstrap = BootstrapFactory.CreateBootstrap();

            if (!bootstrap.Initialize())
            {
                this.Logger.Error("Failed to initialize!");
                return;
            }

            var result = bootstrap.Start();

            if (result == StartResult.Failed)
            {
                this.Logger.Error("Failed to start!");
            }
        }
    }
}
